/*
*
* Copyright (c) 2011 Vaulting Systems International
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy 
* of this software and associated documentation files (the "Software"), to deal 
* in the Software without restriction, including without limitation the rights 
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
* of the Software, and to permit persons to whom the Software is furnished to do  
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all  
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE  
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.ekeyman.securesavelib.domain;

import java.io.Serializable;

public class Resource implements Serializable{
	private static final long serialVersionUID = 7166145468215495785L;

	private long id;
	
	private String resourceUri;
	private String bucketUri;
	private String filename;
	private String filetype;
	private String fileDescription;
	private String passphraseProtected;
	private String fileSignature;
	private long filelength;
	private long version;
	private User user;
	
	public void setId(long id) {
		this.id = id;
	}
	public long getId() {
		return id;
	}
	
	public void setResourceUri(String resourceUri) {
		this.resourceUri = resourceUri;
	}
	public String getResourceUri() {
		return resourceUri;
	}
	

	
	public void setBucketUri(String bucketUri) {
		this.bucketUri = bucketUri;
	}
	public String getBucketUri() {
		return bucketUri;
	}
	public void setFilename(String filename) {
		this.filename = filename;
	}
	public String getFilename() {
		return filename;
	}
	public void setFiletype(String filetype) {
		this.filetype = filetype;
	}
	public String getFiletype() {
		return filetype;
	}
	public void setFilelength(long filelength) {
		this.filelength = filelength;
	}
	public long getFilelength() {
		return filelength;
	}
	public void setFileDescription(String fileDescription) {
		this.fileDescription = fileDescription;
	}
	public String getFileDescription() {
		return fileDescription;
	}
	public void setPassphraseProtected(String passphraseProtected) {
		this.passphraseProtected = passphraseProtected;
	}
	public String getPassphraseProtected() {
		return passphraseProtected;
	}
	public void setFileSignature(String fileSignature) {
		this.fileSignature = fileSignature;
	}
	public String getFileSignature() {
		return fileSignature;
	}
	public void setVersion(long version) {
		this.version = version;
	}
	public long getVersion() {
		return version;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public User getUser() {
		return user;
	}
	@Override
	public boolean equals(Object o){
		boolean result = false;
		if (o instanceof Resource){
			Resource rs = (Resource)o;
			if(resourceUri.equalsIgnoreCase(rs.getResourceUri())) {
				result = true;
			}
		}
		return result;
	}
	
	@Override
	public int hashCode(){
		return resourceUri.hashCode();
	}
}
